As a coding method for a speech signal and an acoustic signal of a low bit (for example, approximately from 10 kbit/s to 20 kbit/s), adaptive coding for an orthogonal transform coefficient, such as DFT (Discrete Fourier Transform) and MDCT (Modified Discrete Cosine Transform) is known. For example, AMR-WB+(Extended Adaptive Multi-Rate Wideband) which is a standard technique of Non-patent literature 1, involves a TCX (Transform Coded Excitation) coding mode. In the TCX coding mode, a gain is determined so as to enable encoding of a sequence obtained by dividing each coefficient in a coefficient sequence by a gain for each predetermined number of bits so as to realize coding at a total number of bits provided for each frame, the coefficient sequence being obtained by normalizing an acoustic signal sequence in a frequency domain with a power spectral envelope coefficient sequence.
<Encoder 1000>
A configuration example of an encoder 1000 for conventional TCX coding is shown in FIG. 1. Components in FIG. 1 will be explained below.
<Frequency Domain Transformation Unit 1001>
A frequency domain transformation unit 1001 transforms an input speech acoustic digital signal (hereinafter, an input acoustic signal) in a time domain into a MDCT coefficient sequence X(1), . . . , X(N) at N points, where N is a positive integer, in a frequency domain for each frame which is a predetermined time segment and outputs the MDCT coefficient sequence.
<Power Spectral Envelope Coefficient Sequence Calculation Unit 1002>
A power spectral envelope coefficient sequence calculation unit 1002 performs linear prediction analysis on the input acoustic signal for each frame to obtain a linear predictive coefficient, and obtains and outputs a power spectral envelope coefficient sequence W(1), . . . , W(N) of the input acoustic signal at N points using the linear predictive coefficient. Further, the linear predictive coefficient is encoded using, for example, a conventional coding technique, and a predictive coefficient code is transmitted to a decoding side.
<Weighted Envelope Normalizing Unit 1003>
A weighted envelope normalizing unit 1003 normalizes each of the coefficients X(1), . . . , X(N) of the MDCT coefficient sequence obtained by the frequency domain transformation unit 1001 using the power spectral envelope coefficient sequence W(1), . . . , W(N) obtained by the power spectral envelope coefficient sequence calculation unit 1002, and outputs the weighted normalized MDCT coefficient sequence XN(1), XN(N). Here, in order to realize quantization so as to reduce auditory distortion, the weighted envelope normalizing unit 1003 normalizes each coefficient of the MDCT coefficient sequence for each frame using the weighted power spectral envelope coefficient sequence in which a power spectral envelope is smoothed. As a result, while the weighted normalized MDCT coefficient sequence XN(1), . . . , XN(N) does not have as large slope of an amplitude or as large fluctuation of the amplitude as that of the input MDCT coefficient sequence X(1), . . . , X(N), the weighted normalized MDCT coefficient sequence XN(1), . . . , XN(N) has a magnitude relationship similar to that of the power spectral envelope coefficient sequence of the input acoustic signal, that is, has a slightly large amplitude in a domain at a coefficient corresponding to a low frequency side and has a microstructure resulting from a pitch period.
<Gain Adjustment Coder 1100>
A gain adjustment coder 1100 outputs an integer signal code and a gain code corresponding to a gain g (global gain) such that the number of bits of the integer signal code becomes as large as possible while being equal to or smaller than the number of allocated bits B which is the number of bits allocated in advance, the integer signal code obtained by encoding the quantized and normalized coefficient sequence XQ(1), . . . , XQ(N) which is a sequence of integer values each obtained by quantizing the result obtained by dividing each coefficient of the input weighted normalized MDCT coefficient sequence XN(1), . . . , XN(N) by the gain g.
The gain adjustment coder 1100 includes an initializing unit 1104, a frequency domain sequence quantizer 1105, a variable-length coder 1106, a decision unit 1107, a gain lower bound setter 1108, a first branching unit 1109, a first gain updating unit 1110, a gain amplifier 1111, a gain upper bound setter 1112, a second branching unit 1113, a second gain updating unit 1114, a gain reducer 1115, a truncation unit 1116 and a gain coder 1117.
<Initializing Unit 1104>
The initializing unit 1104 sets an initial value of the gain g. The initial value of the gain can be determined from energy of the weighted normalization MDCT coefficient sequence XN(1), XN(N) and the number of bits allocated in advance to the code output from the variable-length coder 1106. Hereinafter, the number of bits allocated in advance to the code output from the variable-length coder 1106 will be referred to as the number of allocated bits B. Further, the initializing unit 1104 sets 0 as an initial value of the number of times of updating of the gain.
<Frequency Domain Sequence Quantizer 1105>
The frequency domain sequence quantizer 1105 quantizes values obtained by dividing each coefficient of the weighted normalized MDCT coefficient sequence XN(1), XN(N) by the gain g and obtains and outputs the quantized and normalized coefficient sequence XQ(1), XQ(N) which is a sequence of integer values.
<Variable-Length Coder 1106>
The variable-length coder 1106 performs variable-length encoding of the input quantized and normalized coefficient sequence XQ(1), . . . , XQ(N) to obtain a code and outputs the code. This code is referred to as an integer signal code. This variable-length encoding is performed using, for example, a method in which a plurality of coefficients in the quantized and normalized coefficient sequence are collectively encoded. Further, the variable-length coder 1106 counts the number of bits of the integer signal code obtained through the variable-length encoding. Hereinafter, this number of bits will be referred to as the number of consumed bits c.
<Decision Unit 1107>
The decision unit 1107 outputs the gain, the integer signal code and the number of consumed bits c if the number of times of updating of the gain is a predetermined number of times, or if the number of consumed bits c counted by the variable-length coder 1106 is equal to the number of allocated bits B.
If the number of times of updating of the gain is smaller than the predetermined number of times, it is controlled that, if the number of consumed bits c counted by the variable-length coder 1106 is larger than the number of allocated bits B, the gain lower bound setter 1108 performs the following processing, and, if the number of consumed bits c counted by the variable-length coder 1106 is smaller than the number of allocated bits B, the gain upper bound setter 1112 performs the following processing.
<Gain Lower Bound Setter 1108>
The gain lower bound setter 1108 sets a value of the current gain g as a gain lower bound gmin (gmin←g). This gain lower bound gmin means that the value of the gain should be at least this value or greater.
<First Branching Unit 1109>
Next, the first branching unit 1109 performs control so that if a gain upper bound gmax has been already set, the first gain updating unit 1110 performs the following processing, otherwise, the gain amplifier 1111 performs the following processing. Further, the first branching unit 1109 adds 1 to the number of times of updating of the gain.
<First Gain Updating Unit 1110>
The first gain updating unit 1110 sets, for example, an average value of the value of the current gain g and the gain upper bound gmax as a new value of the gain g (g←(g+gmax)/2), because an optimal gain value exists between the value of the current gain g and the gain upper bound gmax. Because the value of the current gain g is set as the gain lower bound gmin, it can be said that an average value of the gain upper bound gmax and the gain lower bound gmin is set as a new value of the gain g (g←(gmax+gmm)/2). The newly set gain g is input to the frequency domain sequence quantizer 1105.
<Gain Amplifier 1111>
The gain amplifier 1111 sets a value greater than the value of the current gain g as a new value of the gain g. For example, a value obtained by adding a gain change amount Δg which is a positive value defined in advance to the value of the current gain g is set as a new value of the gain g (g←g+Δg). Further, for example, if the gain upper bound gmax is not set and a case occurs a plurality of times in which the number of consumed bits c is larger than the number of allocated bits B, a value greater than the value defined in advance is used as the gain change amount Δg. The newly set gain g is input to the frequency domain sequence quantizer 1105.
<Gain Upper Bound Setter 1112>
The gain upper bound setter 1112 sets the value of the current gain g as the gain upper bound gmax (gmax←g). This gain upper bound gmax means that the value of the gain should be at least this value or smaller.
<Second Branching Unit 1113>
Next, the second branching unit 1113 performs control so that if the gain lower bound gmin has been already set, the second gain updating unit 1114 performs the following processing, otherwise, the gain reducer 1115 performs the following processing. Further, the second branching unit 1113 adds 1 to the number of times of updating of the gain.
<Second Gain Updating Unit 1114>
The second gain updating unit 1114 sets, for example, an average value of the value of the current gain g and the gain lower bound gmin as a new value of the gain g (g←(g+gmin)/2), because an optimal gain value exists between the value of the current gain g and the gain lower bound gmin. Because the value of the current gain g is set as the gain upper bound gmax, it can be said that an average value of the gain upper bound gmax and the gain lower bound gmin is set as a new value of the gain g (g←(gmax+gmin)/2). The newly set gain g is input to the frequency domain sequence quantizer 1105.
<Gain Reducer 1115>
The gain reducer 1115 sets a value smaller than the value of the current gain g as a new value of the gain g. For example, a value obtained by subtracting a gain change amount Δg which is a positive value defined in advance from the value of the current gain g is set as a new value of the gain g (g←g−Δg). Further, for example, if the gain lower bound gmin is not set and a case occurs a plurality of times in which the number of consumed bits c is smaller than the number of allocated bits B, a value greater than the value defined in advance is used as the gain change amount Δg. The newly set gain g is input to the frequency domain sequence quantizer 1105.
<Truncation Unit 1116>
If the number of consumed bits c output from the decision unit 1107 is larger than the number of allocated bits B, the truncation unit 1116 removes a code corresponding to the number of bits by which the number of consumed bits c exceeds the number of allocated bits B from a code corresponding to the quantized and normalized coefficients at a higher frequency side in the integer signal code output from the decision unit 1107 and outputs the resultant as a new integer signal code. For example, the truncation unit 1116 outputs as a new integer signal code, the remaining code obtained by removing the code corresponding to the quantized and normalized coefficients at a higher frequency side corresponding to the number of bits c-B by which the number of consumed bits c exceeds the number of allocated bits B from the integer signal code. Meanwhile, if the number of consumed bits c output from the decision unit 1107 is not larger than the number of allocated bits B, the truncation unit 1116 outputs the integer signal code output from the decision unit 1107.
<Gain Coder 1117>
The gain coder 1117 encodes the gain output from the decision unit 1107 using a predetermined number of bits to obtain a gain code and outputs the gain code.
Meanwhile, as a method for efficiently performing variable-length encoding of an integer signal, there is an encoding method based on periodicity disclosed in Patent literature 1. In this method, the quantized and normalized coefficient sequence is rearranged so that one or a plurality of successive samples comprising a sample corresponding to a basic frequency and one or a plurality of successive samples comprising a sample corresponding to an integral multiple of the basic frequency are gathered, and variable-length encoding is performed on the rearranged sample sequence to obtain an integer signal code. By this means, a change of the amplitude between adjacent samples becomes small, so that it is possible to improve efficiency of variable-length encoding.
Further, Patent literature 1 discloses a method of obtaining an integer signal code by selecting a method which realizes a smaller number of bits of the integer signal code or a method which is expected to realize a smaller number of bits of the integer signal code, between an encoding method based on periodicity in which an integer signal code is obtained by performing variable-length encoding of the rearranged sample sequence and an encoding method which is not based on periodicity and in which an integer signal code is obtained by performing variable-length encoding of a sample sequence before rearrangement. By this means, it is possible to obtain an integer signal code with a smaller number of bits under the same encoding distortion.